home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
RTF
/
debug.h
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
1KB
|
53 lines
/* debug.h -- Connolly's debugging junk
* 7 Jun 90 by Connolly
* $Header: /usr/people/pcd/Src/RTF/RCS/debug.h,v 1.1 92/11/23 12:58:50 pcd Exp Locker: pcd $
*
*
* USE: debug(("debugging message", printf, args))
* just like you would printf, but with extra ().
* They disappear at compile time if DEBUG is not 1.
*/
#define DEBUG_DEFAULT 0
#ifndef DEBUG
#define DEBUG DEBUG_DEFAULT
#endif
#if DEBUG
# include <stdio.h>
# define debug(x) printf x
# define Debug(s, x) ((debug_##s) ? printf x : 0)
#else
# define debug(x) do{}while(0)
# define Debug(s, x) do{}while(0)
#endif
/*
* REQUIRE(condition, stmnt_if_fail)
* be sure to free dynamic memory on failure.
* e.g.
* p = malloc(size);
* REQUIRE(x>0, return (free(p), -1));
*/
#define REQUIRE(x,return_y) \
if(!(x)){ \
debug(("requirement failed: %s\n", #x)); \
return_y; \
}
#define TIMING_DEFAULT 0
#ifndef TIMING
#define TIMING TIMING_DEFAULT
#endif
#if TIMING
extern "C" clock(void);
#define timing(s) printf("<%s>clock = %d\n", s, clock())
#else
#define timing(s) do{}while(0)
#endif